home *** CD-ROM | disk | FTP | other *** search
/ Java Primer Plus / Java Primer Plus (Waite Group Proess)(1996).iso / chapter9 / brothers / dad.java < prev    next >
Encoding:
Java Source  |  1995-12-31  |  1.4 KB  |  57 lines

  1. package brothers;
  2.  
  3. // ------------------ The Dad Class ----------------- //
  4.     private class Dad {
  5.  
  6.       private           boolean sportscar;
  7.                         boolean fishing_boat;  // default
  8.       protected         boolean golf_clubs;
  9.       public            boolean lawnmower;
  10.  
  11.       private protected boolean familycar;
  12. // SAME!  protected private boolean xx;
  13.  
  14. //      public protected  boolean pubprot;
  15.       protected public  boolean pubprot;
  16.  
  17. //      public private  boolean pubprot;
  18. //      private public  boolean pubprot;
  19.     
  20. //      private public protected  boolean pubprot;
  21. //      public private protected  boolean pubprot;
  22. //      private protected public  boolean pubprot;
  23. //      public protected private  boolean pubprot;
  24. //      protected public private  boolean pubprot;
  25. //      protected private public  boolean pubprot;
  26.  
  27.       
  28.       public Dad() { 
  29.  
  30.       // Dad can access everything, after all it is
  31.       // his stuff (i.e. declared in his class)
  32.  
  33.     pubprot =true;
  34.  
  35.         sportscar    = true;
  36.         fishing_boat = true;
  37.         golf_clubs   = true;
  38.         familycar    = true;
  39.         lawnmower    = true;
  40.         }
  41.       }
  42.     
  43.  
  44. class lilbrother extends Dad {
  45.  
  46.       public lilbrother() {
  47. //        sportscar    = true; // ERROR! Dad only!
  48.         fishing_boat = true; // ERROR! Dad and UncleFrank only!
  49.         golf_clubs   = true; // Ok, but be careful
  50.         familycar    = true; // Son can borrow
  51.         lawnmower    = true; // Yeah, sure anybody
  52.  
  53. pubprot=true;
  54.         }
  55.  
  56.     }
  57.